#include <iostream>
#include <cstring>

using namespace std;

int main() {

    char array1[12] = "I am Ray";
    char array2[12] = {'I', ' ', 'a', 'm', ' ', 'R', 'a', 'y'};
    char array3[12] = {'I', ' ', 'a', 'm', '\\', '0', 'R', 'a', 'y'};
    char array4[12] = {'I', ' ', 'a', 'm', 0, 'R', 'a', 'y'};
    char array5[12] = {'I', ' ', 'a', 'm', '0', 'R', 'a', 'y'};
    char array6[12] = {};
    char array7[12] = {};
    char array8[12] = {};
    /*
    int endl = 1;
    cout << endl << " aaa " << endl;
    */

    cout << "array1: " << array1 << endl;
    cout << "strlen(array1): " << strlen(array1) << endl;
    cout << "sizeof(array1): " << sizeof(array1) << endl;
    cout << endl;

    cout << "array2: " << array2 << endl;
    cout << "strlen(array2): " << strlen(array2) << endl;
    cout << "sizeof(array2): " << sizeof(array2) << endl;
    cout << endl;

    cout << "array3: " << array3 << endl;
    cout << "strlen(array3): " << strlen(array3) << endl;
    cout << "sizeof(array3): " << sizeof(array3) << endl;
    cout << endl;

    cout << "array4: " << array4 << endl;
    cout << "strlen(array4): " << strlen(array4) << endl;
    cout << "sizeof(array4): " << sizeof(array4) << endl;
    cout << endl;

    cout << "array5: " << array5 << endl;
    cout << "strlen(array5): " << strlen(array5) << endl;
    cout << "sizeof(array5): " << sizeof(array5) << endl;
    cout << endl;

    cout << "array6: " << array6 << endl;
    cout << "strlen(array6): " << strlen(array6) << endl;
    cout << "sizeof(array6): " << sizeof(array6) << endl;
    cout << endl;

    cout << "please input value for char array7[12]:" << endl;
    cin.getline(array7, 12);
    cout << "array7: " << array7 << endl;
    cout << "strlen(array7): " << strlen(array7) << endl;
    cout << "sizeof(array7): " << sizeof(array7) << endl;
    cout << endl;

    cout << "please input value for char array8[12]:" << endl;
    cin >> array8;
    cout << "array8: " << array8 << endl;
    cout << "strlen(array8): " << strlen(array8) << endl;
    cout << "sizeof(array8): " << sizeof(array8) << endl;
    cout << endl;

    /* 遍历字符数组array1表示的字符串中的每一个字符, 如果遇到大写字母，将其转换成小写字母；
       如果遇到小写字母，将其转换成大写字母 */
    for (int i = 0; i < strlen(array1); i++){
        if (array1[i] <= 'Z' && array1[i] >= 'A'){
            array1[i] = array1[i] + 32;
        }else if (array1[i] <= 'z' && array1[i]>= 'a'){
            array1[i] =array1[i] - 32;
        }

    }
    cout << array1;

    return 0;
}